Release 10.1A: OpenEdge Development:
Programming Interfaces
QUOTER utility
The
QUOTERutility formats character data in a file to the standard format so it can be used by a Progress procedure. By default,QUOTERdoes the following:You can use the
QUOTERutility directly from the operating system using the operating system statement, as appropriate, to reformat data from a file that is not in the standard Progress input format:
input-file-nameSpecifies the file you are using.
>output-file-nameSpecifies the file where you want to send the output.
-dcharacterIdentifies a field delimiter. You can specify any punctuation character.
-cstartcol-stopcolSpecifies the ranges of column numbers to be read as fields. Do not use any spaces in the range list.
Suppose your data file looked like the following example:
You use
QUOTERto put this file into standard format. Use commands shown in Table E–1 to runQUOTERfrom the Procedure Editor.
In Figure E–1,
i-datfl2.dis the name of the data file you supply toQUOTERwhilei-datfl2.qis the name of the file in which you want to storeQUOTER’s output.Figure E–1: How QUOTER prepares a file
![]()
The
i-datfl2.qfile contains theQUOTERoutput:
Now this file is in the appropriate format to be used as input to a Progress procedure.
What if each of the field values in your data file is not on a separate line (unlike
i-datfl2.d) and without quotes (unlikei-datf1.d)? That is, your data file looks likei-datfl3.d:
Suppose you wanted to use this file as the input source to create customer records for customers
90,91, and92. You need to make each line of the file into a character string and then assign a substring of this value to each field. The procedurei-chgin3.pdoes that:
The numbers to the left of the procedure correspond to the following step-by-step descriptions:
- The
QUOTERutility takes the data from thei-datfl3.dfile and produces data that looks like the following example:
- The
INPUTFROMstatement redirects the input stream to get input from thei-datfl3.qfile.- The
CREATEstatement creates an empty customer record.- The
SETstatement uses the first quoted line in thei-datfl3.qfile as input and puts that line in the data variable. Once that line of data is in the line variable, the next statements break it up into pieces that get stored in individual customer fields.- The
SUBSTRINGfunctions take the appropriate pieces of the data in the line variable and store the data in thecust–num,name, andsales–repfields, as shown in Figure E–2.Figure E–2: Extracting QUOTER input with SUBSTRING
![]()
Because Progress assumes that all the data in the
i-datfl3.qfile is character data, you must use theINTEGERfunction to convert thecust–numdata to an integer value.Note: With this method, all trailing blanks are stored in the database. To avoid this problem, use the- The
INPUTCLOSEstatement closes the input stream coming from thei-datfl3.qfile and redirects the input stream to the terminal.–cor–doption ofQUOTER.You can use
QUOTERto prepare files formatted in other ways as well. For example, suppose the field values in your data file are separated by a specific character, such as a comma (,), as ini-datfl4.d:
You can use a special option,
-d, (on UNIX) to tellQUOTERwhat character separates fields. The procedurei-chgin4.preads the comma-separated data fromi-datfl4.d:
Here, the
-doption or theDELIMITERqualifier tellsQUOTERthat a comma (,) is the delimiter between each field in the data file. The output ofQUOTERis shown ini-datfl4.q:
This data file is in the standard blank-delimited Progress format. If your data file does not use a special field delimiter that you can specify with the
–d QUOTERoption or the/DELIMITERqualifier, but does have each data item in a fixed column position, you can use another special option,–c, on Windows and UNIX.You use the
–coption or/COLUMNSto identify the columns in which fields begin and end. For example, suppose your file looks likei-datfl5.d:
The procedure
i-chgin5.puses this data file to create customer records:
Because you used the
–coption, this procedure produces a data file without trailing blanks.You can also use
QUOTERinteractively to reformat your data. You can accessQUOTERinteractively through the Administration Tool or, in character interfaces, the Data Dictionary. From the main menu, choose Utilities.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |